import {
    hospitalListReqReturnType,
    getHosParamsTypes,
    provinceReturnType,
    hospitalDetailType,
    hospitalDepartmentType,
    scheduleTimeParamsType,
    hosScheduleTimeType,
    findScheduleListReturnType,
    findScheduleListParamsType
} from './model/hospitalListType'

import request from '@utils/http/request'


/** 第一个any是代表没有经过拦截器处理的数据类型，第二个是经过拦截器处理后的request.data.data的类型**/ 
//请求医院列表展示在表格
export const getHospitalListRequest =(page:number,limit:number,getHosParams:getHosParamsTypes)=>{
    return request.get<any,hospitalListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}`,{
        params:getHosParams
    })
}
//请求省份
export const getProvinceRequest =()=>{
    return request.get<any,provinceReturnType>('/admin/cmn/dict/findByDictCode/province')
}

//请求市/或县
export const getCityOrDistrictRequset=(parentVaule:number)=>{
    return request.get<any,provinceReturnType>(`/admin/cmn/dict/findByParentId/${parentVaule}`)
}

//请求医院详情
export const getHospitalDetailRequest=(id:string)=>{
    return request.get<any,hospitalDetailType>(`/admin/hosp/hospital/show/${id}`)
}
//发送修改上线和下线的请求
export const changeStatusRequest =(id:string,status:0|1)=>{
    return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}
//发送请求医院科室的请求
export const getHosDepartmentRequest =(hoscode:string)=>{
    return request.get<any,hospitalDepartmentType>(`/admin/hosp/department/${hoscode}`)
}
//请求科室排班时间
export const getDepartmentScheduleTimeRequest=({page,limit,hoscode,depcode}:scheduleTimeParamsType)=>{
    return request.get<any,hosScheduleTimeType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}
//请求某一时间科室排班的详细数据
export const findScheduleListRequest =({hoscode,depcode,workDate}:findScheduleListParamsType)=>{
    return request.get<any,findScheduleListReturnType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}